import qs from 'qs';
const http = uni.$u.http;

const header = {
	'content-type': 'application/x-www-form-urlencoded'
}

const jsonHeader = {
	'content-type': 'application/json'
}

// post 单个参数提交 设置请求头 header:{'content-type':'application/x-www-form-urlencoded'}
// post请求示例 export const postMenu = (params, config = {}) => http.post('/public_api/index', params, config)
// get请求示例 export const getMenu = (data) => http.get('/public_api/index', data)


//获取首页
export const getIndex = (data) => http.get('/index', data)
//校验当前用户是否登录
export const checkMemberLogin = (data) => http.get('/checkMemberLogin', data)

//获取公众号授权登录地址
export const getAuthUrl = (data) => http.get('/getAuthUrl', data)
//获取公众号配置
export const getWxConfig = (params, config = {}) => http.post('/wxMp/getWxConfig', params, config)

//微信登录
export const wxLogin = (params, config = {}) => http.post('/wxLogin', params, config)
//微信登录
export const wxMpLogin = (data, config = {
	header
}) => http.post('/wxMp/wxLogin', data, config)
//检查手机号是否被注册
export const checkTele = (params, config = {}) => http.post('/wxMp/checkTele', params, config)

//检测是否已设置支付密码
export const hasPayPassword = (params, config = {}) => http.post('/hasPayPassword', params, config)
//校验支付密码
export const checkPayPassword = (params, config = {}) => http.post('/checkPayPassword', params, config)
//设置支付密码
export const setPayPassword = (params, config = {}) => http.post('/setPayPassword', params, config)
export const setPwd = (data, config = {
	header
}) => http.post('/updatePayPassword', data, config)
export const setPassword = (params, config = {}) => http.post('/setMemberPassword', params, config)
export const changePassword = (data, config = {
	header
}) => http.post('/updateMemberPassword', data, config)
//获取微信支付
export const getWxPayConfig = (params, config = {}) => http.post('/wxPay/create', params, config)
//获取支付结果
export const getPayStatus = (params, config = {}) => http.post('/wxPay/getPayStatus', params, config)

//获取短信验证码
export const sendCode = (data, config = {
	header
}) => http.post('/sendSms', data, config)

//用户账号登录 1000.账号密码登录 1001.短信注册登录 1002.短信登录
export const doLogin = (data, config = {
	header
}) => http.post('/codeLogin', data, config)

export const memberLogin = (data, config = {
	header
}) => http.post('/memberLogin', data, config)

//退出登录
export const logout = (params, config = {}) => http.post('/wxLogout', params, config)

//获取用户信息
export const getUserInfo = (params, config = {}) => http.post('/getMemberInfo', params, config)

//更新用户资料
export const setUserInfo = (params, config = {}) => http.post('/setMemberInfo', params, config)

//获取轮播图
export const getRotations = (params, config = {}) => http.post('/getBanners', params, config)

//创建合同
export const saveContract = (data, config = {}) => http.post('/contract/save', data, config)
//履约提醒
export const getEginList = (data, config = {}) => http.post('/contract/myList?' + qs.stringify(data), config)
//获取合同列表
export const getContracts = (data, config = {}) => http.post('/contract/list?' + qs.stringify(data), config)
//获取合同信息
export const getContract = (data, config = {}) => http.post('/contract/get', data, config)
//获取爱签合同地址
export const getPreviewUrl = (data, config = {}) => http.post('/contract/getPreviewUrl', data, config)
//删除合同
export const delSign = (data, config = {}) => http.post('/contract/del', data, config)
//销账
export const endSign = (data, config = {}) => http.post('/contract/end', data, config)
//分期销账
export const repayStages = (data, config = {
	header
}) => http.post('/contract/repayStages', data, config)
//获取合同信息
export const getBySignNo = (data, config = {}) => http.post('/contract/getBySignNo', data, config)


//提交实名信息，获取认证页面
export const submitAuth = (data, config = {
	header
}) => http.post('/aq/faceAuth', data, config)

//提交认证状态
export const submitAuthRes = (data, config = {
	header
}) => http.post('/aq/submitAuthRes', data, config)

//保存投诉建议
export const saveComplaint = (data, config = {
	jsonHeader
}) => http.post('/complaint/save', data, config)

//添加双方签约人，并生成协议
export const addSign = (data, config = {}) => http.post('/contract/addSign', data, config)